#ifndef __AC_SIGNAL_H_H_
#define	__AC_SIGNAL_H_H_

#include "stdint.h"

#ifdef	__cplusplus
extern "C" {
#endif

	typedef struct
	{
		uint16_t ad_val;			
		uint16_t ad_set;			
		uint16_t out_period;		
		int8_t st_cnt_max;			
		
		uint8_t elec_period;		
		uint16_t check_delay;		
		uint8_t elec_effective;		
		
		uint8_t elec_tick_cnt;		
		uint8_t elec_found_cnt;		
		uint8_t elec_found_keep;	
		uint8_t out_st_old;			
		uint16_t out_st_keep_cnt;	
		uint16_t out_cnt;			
		
		int8_t short_elec_cnt;		
		int8_t open_elec_cnt;			
		int8_t short_period_cnt;	
		int8_t open_period_cnt;		
		int8_t err_short_out;		
		int8_t err_open_out;		
	} out_current_check_type;
	
	void current_async_check_handle(out_current_check_type * obj, uint8_t out_st);
	
	void current_osync_check_handle(out_current_check_type * obj, uint8_t out_st);

	typedef struct
	{
		int8_t time_out_set;		
		int8_t phase; 				
		
		int8_t signal_flt;  		
		uint8_t signal_st;  		
		uint8_t signal_old; 		
		int8_t wide; 				
		int8_t period;				
		int8_t period1, period2;	
		int8_t cnt; 				
		uint8_t err; 				
		uint8_t out_at_sig;			
		uint8_t out_at_sig_none;	
		uint8_t out;				
		uint16_t period_keep_cnt;	
	} half_ac_sync_out_point_type;

	uint8_t half_ac_sync_out_point_handle(half_ac_sync_out_point_type * obj, uint8_t signal);

#ifdef	__cplusplus
}
#endif

#endif	

